Method and device for polar code rate matching

ABSTRACT

Embodiments of the application provide a method and device for polar code rate matching in a wireless communication network. A device of the network obtains K information bits. The device generates a to-be-encoded sequence having a length N bits. The to-be-encoded sequence includes the K information bits and L frozen bits. The L frozen bits are placed in L bit positions of the to-be-encoded sequence. The L bit positions are determined according to a rate match manner which is either puncturing or shortening. The device polar encodes the to-be-encoded sequence to obtain the encoded sequence. The device interleaves the encoded sequence to obtain an interleaved sequence and then stores the interleaved sequence into a cyclic cache. The device sequentially outputs M bits of the interleaved sequence from the cyclic cache according to the rate matching manner.

CROSS-REFERENCE TO RELATED APPLICATIONS

This application is a continuation of U.S. patent application Ser. No.16/214,147, filed on Dec. 10, 2018, which is a continuation ofcontinuation of International Application No. PCT/CN2018/079947, filedon Mar. 22, 2018. The International Application claims priority toChinese Patent Application No. 201710184083.8, filed on Mar. 24, 2017.All of the aforementioned patent applications are hereby incorporated byreference in their entireties.

TECHNICAL FIELD

Embodiments of this application relate to encoding and decodingtechnologies, and in particular, to a method and device for polar coderate matching.

BACKGROUND

Channel encoding is used in communication systems to improve datatransmission reliability, so as to ensure communication quality. Polarcodes, proposed by Professor Arikan of Turkey, are the first kind ofcodes that are theoretically proven to be able to achieve the Shannoncapacity and having low encoding and decoding complexity. Therefore, thepolar codes have a great development and application potential in thefifth generation (5G) communication systems, and were accepted forcontrol channel encoding at the 3GPP (3rd Generation PartnershipProject) RAN 1 (RAN: Radio Access Network) #87 meeting.

In actual applications, information to be transmitted is encoded at thetransmitting end, and received encoded information is decoded at thereceiving end. Normally, polar codes have fixed lengths. For improvingtransmission efficiency, an encoder may need to perform rate matchingafter encoding, so as to obtain a polar code of any code length throughthe rate matching. The encoder performs rate matching by using bitrepetition, puncturing, or shortening on a transmission channel.However, all the three rate matching manners in the prior art need to beimplemented by using respective hardware. When all of the three ratematching manners are used, three different sets of hardware arerequired. Consequently, hardware implementation complexity is high, andequipment volume is large.

SUMMARY

Embodiments of the present application provides a polar code ratematching method and device, in order to reduce hardware complexity andan area occupied by hardware.

According to a first aspect, embodiments of this application providemethod for a polar rate matching, including:

polar encoding, according to a mother code length N and a rate matchingmanner, to obtain encoded bits, wherein the rate matching manner is afirst rate matching manner or a second rate matching manner, and N is apositive integer;

storing, into a cyclic cache according to a bit storage ordercorresponding to the rate matching manner, the encoded bits obtainedafter the polar encoding, wherein the first rate matching manner and thesecond rate matching manner are corresponding to a same bit storageorder; and

reading, from the cyclic cache according to a bit reading ordercorresponding to the rate matching manner, an output sequence, whereinthe first rate matching manner and the second rate matching manner arecorresponding to different bit reading orders.

Because the different rate matching manners are corresponding to thesame bit storage order, to ensure that correct output sequences can beoutput according to in the different rate matching manners after ratematching, the different rate matching manners are corresponding todifferent bit reading orders, namely, different bit selection orders.

In a possible design, a length of the output sequence is a target codelength M, where M is an integer;

a target code length M corresponding to the first rate matching manneris less than the mother code length N; and

a target code length M corresponding to the second rate matching manneris greater than the mother code length N.

In a possible design, wherein storing, into a cyclic cache according toa bit storage order corresponding to the rate matching manner, theencoded bits after the polar encoding specifically comprises:

interleaving, according to an interleaving manner corresponding to therate matching manner, on the encoded bits obtained after the polarencoding, to obtain interleaved bits, wherein the bit storage order ofthe encoded bits is the same as an order of the interleaved bits; and

collecting the interleaved bits, and storing the interleaved bits intothe cyclic cache.

By using the interleaving manner, a puncturing bit or a shortening bitmay be set in a preset location, to facilitate reading by the encoder.

In a possible design, wherein a bit reading order corresponding to thefirst rate matching manner is sequentially reading from an (N−M+1)^(th)bit to an N^(th) bit in the cyclic cache; or a bit reading ordercorresponding to the first rate matching manner is sequentially readingfrom a first bit to an M^(th) bit in the cyclic cache;

a bit reading order corresponding to the second rate matching manner issequentially and cyclically reading, starting from any location of thecyclic cache to an M^(th) bit in the cyclic cache in natural order or inreversed order.

In a possible design, a puncturing bit or a shortening bit indicated bythe first rate matching manner is in a first set, and a bit readingorder corresponding to the first rate matching manner is:

sequentially reading the encoded bits in the cyclic cache in naturalorder or in reversed order; and when a sequence number corresponding toa current bit is in the first set, skipping the current bit, andcontinuing with reading until a last bit is read; and

a bit reading order corresponding to the second rate matching manner issequentially and cyclically reading, starting from any location of thecyclic cache to an M^(th) bit in the cyclic cache in natural order or inreversed order.

In a possible design, wherein storing, into a cyclic cache according toa bit storage order corresponding to the rate matching manner, theencoded bits obtained after the polar encoding specifically comprises:

interleaving, according to an interleaving manner corresponding to therate matching manner, on the encoded bits, to obtain interleaved bits,where the bit storage order corresponding to the rate matching manner isthe same as an order of the interleaved bits; and

bit collecting on the interleaved bits, and storing the interleaved bitsinto the cyclic cache, wherein one or more bits are deleted from theinterleaved bits by puncturing in the bit collecting or wherein one ormore bits are deleted from the interleaved bits by shortening in the bitcollecting.

In a possible design, wherein storing, into a cyclic cache according toa bit storage order corresponding to the rate matching manner, theencoded bits obtained after the polar encoding specifically comprises:

bit collecting, according to the bit storage order corresponding to therate matching manner, on the encoded bits, and storing the encoded bitsinto the cyclic cache, wherein one or more bits are deleted from theencoded bits by puncturing in the bit collecting or one or more bits aredeleted from the encoded bits by shortening in the encoded bits in thebit collecting, the bit storage order corresponding to the rate matchingmanner is natural order or reversed order, and no interleaver isrequired for implementation, thereby reducing hardware configurationsand hardware complexity.

In a possible design, wherein the bit reading order corresponding to thefirst rate matching manner is reading, in natural order, from a firstbit to a last bit in the cyclic cache, or reading, in reversed order,from a last bit to a first bit in the cyclic cache; and

a bit reading order corresponding to the second rate matching manner issequentially and cyclically reading M bits starting from any location inthe cyclic cache in natural order or in reversed order.

In a possible design, wherein the bit storage order comprise at leastone or a combination of the following:

the encoded bits are sorted in the cyclic cache in descending order, inascending order, in descending order after bit reversal, in ascendingorder after bit reversal, in descending order of reliability, inascending order of reliability, in random order, in ascending orderafter offset bit reversal, in descending order after offset bitreversal, or in an order corresponding to bitwise linear interleaving.

In a possible design, wherein the interleaving manner is used toindicate a quantity Rn of rows, a quantity Cn of columns, and row-columninterleaving or column-row interleaving, where both Rn and Cn areinteger powers of 2, and N=Rn×Cn; and

when the interleaving manner is the column-row interleaving, the bitstorage order is sorting, by row, encoded bits obtained after bitreversal and column interleaving, where each row of the encoded bits isused as a sub-segment, and the encoded bits obtained after bit reversaland column interleaving are encoded bits that are obtained after bitreversal and column interleaving; and

a bit reading order corresponding to the first rate matching manner issequentially reading one bit from each sub-segment after bit reversaland row interleaving are performed on the encoded bits obtained afterbit reversal and column interleaving, until M bits are read; and a bitreading order corresponding to the second rate matching manner issequentially and cyclically reading, in natural order or in reversedorder by row and starting from any location in the encoded bits obtainedafter bit reversal and column interleaving, the encoded bits in thecyclic cache until M bits are read; or

when the interleaving manner is the row-column interleaving, the bitstorage order is sorting, by column, encoded bits obtained after bitreversal and row interleaving, where each column of the encoded bits isused as a sub-segment, and the encoded bits obtained after bit reversaland row interleaving are encoded bits that are obtained after bitreversal and row interleaving are performed on the encoded bits obtainedafter the polar encoding; and

a bit reading order corresponding to the first rate matching manner issequentially reading one bit from each sub-segment after bit reversaland column interleaving are performed on the encoded bits obtained afterbit reversal and row interleaving, until M bits are read; and a bitreading order corresponding to the second rate matching manner issequentially and cyclically reading, in natural order or in reversedorder by column and starting from any location in the encoded bitsobtained after bit reversal and row interleaving, the encoded bits inthe cyclic cache until M bits are read.

A second aspect of the embodiments of this application provides A methodfor polar code rate matching, comprising:

polar encoding, according to a mother code length N and a rate matchingmanner, to obtain encoded bits after the polar encoding, where the ratematching manner is one of a first rate matching manner, a second ratematching manner, and a third rate matching manner, and N is a positiveinteger;

storing, into a cyclic cache according to a bit storage ordercorresponding to the rate matching manner, the encoded bits, wherein thefirst rate matching manner, the second rate matching manner, and thethird rate matching manner are corresponding to a same bit storageorder; and

reading, from the cyclic cache according to a bit reading ordercorresponding to the rate matching manner, an output sequence obtainedafter rate matching, where at least two of the first rate matchingmanner, the second rate matching manner, and the third rate matchingmanner are corresponding to different bit reading orders.

Because the different rate matching manners are corresponding to thesame bit storage order, to ensure that correct output sequences can beoutput according to in the different rate matching manners after ratematching, the different rate matching manners are corresponding todifferent bit reading orders, namely, different bit selection orders.

In a possible design, a length of the output sequence is a target codelength M, where M is an integer;

a target code length M corresponding to the first rate matching manneris less than the mother code length N;

a target code length M corresponding to the second rate matching manneris less than the mother code length N; and

a target code length M corresponding to the third rate matching manneris greater than the mother code length N.

In a possible design, wherein the first rate matching manner, the secondrate matching manner, and the third rate matching manner arecorresponding to different bit reading orders.

In a possible design, wherein storing, into a cyclic cache according toa bit storage order corresponding to the rate matching manner, theencoded bits after the polar encoding specifically comprises:

interleaving, according to an interleaving manner corresponding to therate matching manner, on the encoded bits obtained after the polarencoding, to obtain interleaved bits, wherein the bit storage order ofthe encoded bits is the same as an order of the interleaved bits; and

collecting, the interleaved bits, and storing the interleaved bits intothe cyclic cache.

In a possible design, wherein the bit storage order comprises: a firststorage order and a second storage order, where the first rate matchingmanner is used to indicate the first storage order in advance, and thesecond rate matching manner is used to indicate the second storage orderin advance; and

wherein the first storage order is used to indicate a storage order, inthe cyclic cache, of first N/2 bits of the encoded bits, and the secondstorage order is used to indicate a storage order, in the cyclic cache,of last N/2 bits of the encoded bits; or

wherein the first storage order is used to indicate a storage order, inthe cyclic cache, of last N/2 bits of the encoded bits, and the secondstorage order is used to indicate a storage order, in the cyclic cache,of first N/2 bits of the encoded bits.

In a possible design, wherein the first storage order comprises at leastone or a combination of the following:

a descending order, an ascending order, a descending order ofreliability, an ascending order of reliability, a random order, an ordercorresponding to bitwise linear interleaving, and a reversed order of anorder corresponding to bitwise linear interleaving; and

wherein the second storage order comprises at least one or a combinationof the following:

a descending order, an ascending order, a descending order after bitreversal, an ascending order after bit reversal, a descending order ofreliability, an ascending order of reliability, a random order, anascending order after offset bit reversal, a descending order afteroffset bit reversal, an order corresponding to bitwise linearinterleaving, and a reversed order of an order corresponding to bitwiselinear interleaving.

In a possible design, when the first storage order is used to indicatethe storage order, in the cyclic cache, of the first N/2 bits of theencoded bits, and the second storage order is used to indicate thestorage order, in the cyclic cache, of the last N/2 bits of the encodedbits, a bit reading order corresponding to the first rate matchingmanner is sequentially reading from an (N−M+1)^(th) bit to an N^(th) bitin the cyclic cache, and a bit reading order corresponding to the secondrate matching manner is sequentially reading from a first bit to anM^(th) bit in the cyclic cache; or

when the first storage order is used to indicate the storage order, inthe cyclic cache, of the last N/2 bits of the encoded bits obtainedafter the polar encoding, and the second storage order is used toindicate the storage order, in the cyclic cache, of the first N/2 bitsof the encoded bits, a bit reading order corresponding to the first ratematching manner is sequentially reading from a first bit to an M^(th)bit in the cyclic cache, and a bit reading order corresponding to thesecond rate matching manner is sequentially reading an (N−M+1)^(th) bitto an N^(th) bit in the cyclic cache; and

a bit reading order corresponding to the third rate matching manner issequentially and cyclically reading, starting from any location and innatural order or in reversed order, the encoded bits in the cyclic cacheuntil M bits are read.

In a possible design, a sequence number of a puncturing bit in the firstrate matching manner is in a first set, and a sequence number of ashortening bit in the second rate matching manner is in a second set;

a bit reading order corresponding to the first rate matching manner is:

sequentially reading the cyclic cache in natural order or in reversedorder; and when a sequence number corresponding to a current bit is inthe first set, skipping the current bit, and continuing with readinguntil a last bit is read;

a bit reading order corresponding to the second rate matching manner is:sequentially reading the cyclic cache in natural order or in reversedorder; and when a sequence number corresponding to a current bit is inthe second set, skipping the current bit, and continuing with readinguntil a last bit is read; and

a bit reading order corresponding to the third rate matching manner issequentially and cyclically reading, starting from any location and innatural order or in reversed order, the encoded bits in the cyclic cacheuntil M bits are read.

In a possible design, wherein the first rate matching manner and thesecond rate matching manner are corresponding to a same bit readingorder, and wherein the first rate matching manner and the third ratematching manner are corresponding to different bit reading orders.

In a possible design, wherein the storing, into a cyclic cache accordingto a bit storage order corresponding to the rate matching manner, theencoded bits comprises:

interleaving, according to an interleaving manner corresponding to therate matching manner, on the encoded bits, to obtain interleaved bits,wherein the bit storage order is the same as an order of the interleavedbits; and

bit collecting on the interleaved bits, and storing the interleaved bitsinto the cyclic cache, wherein one or more bits are deleted from theinterleaved bits by puncturing in the bit collecting or wherein one ormore bits are deleted from the interleaved bits by shortening in the bitcollecting.

In a possible design, wherein the storing, into a cyclic cache accordingto a bit storage order corresponding to the rate matching manner, theencoded bits comprises:

bit collecting, according to the bit storage order corresponding to therate matching manner, on the encoded bits, and storing the encoded bitsinto the cyclic cache, wherein one or more bits are deleted from theencoded bits by puncturing in the bit collecting or one or more bits aredeleted from the encoded bits by shortening in the encoded bits in thebit collecting, the bit storage order corresponding to the rate matchingmanner is natural order or reversed order.

In a possible design, wherein the bit reading order corresponding to thefirst rate matching manner is reading, in natural order, from a firstbit to a last bit in the cyclic cache, or reading, in reversed order,from a last bit to a first bit in the cyclic cache; and

a bit reading order corresponding to the third rate matching manner issequentially and cyclically reading M bits, starting from any locationin the cyclic cache in natural order or in reversed order.

A third aspect of the embodiments of this application provides a devicefor polar code rate matching, including:

an encoding module, configured to polar encode according to a mothercode length N and a rate matching manner to obtain encoded bits, whereinthe rate matching manner is a first rate matching manner or a secondrate matching manner, and N is a positive integer;

a storage module, configured to store, into a cyclic cache according toa bit storage order corresponding to the rate matching manner, theencoded bits obtained after the polar encoding, wherein the first ratematching manner and the second rate matching manner are corresponding toa same bit storage order; and

a reading module, configured to read, from the cyclic cache according toa bit reading order corresponding to the rate matching manner, an outputsequence, wherein the first rate matching manner and the second ratematching manner are corresponding to different bit reading orders.

In a possible design, a length of the output sequence is a target codelength M, where M is an integer;

a target code length M corresponding to the first rate matching manneris less than the mother code length N; and

a target code length M corresponding to the second rate matching manneris greater than the mother code length N.

In a possible design, wherein the storage module is configured tointerleave according to an interleaving manner corresponding to the ratematching manner, on the encoded bits obtained after the polar encoding,to obtain interleaved bits, wherein the bit storage order of the encodedbits is the same as an order of the interleaved bits; and

collect the interleaved bits, and storing the interleaved bits into thecyclic cache.

In a possible design, wherein a bit reading order corresponding to thefirst rate matching manner is sequentially reading from an (N−M+1)^(th)bit to an N^(th) bit in the cyclic cache; or a bit reading ordercorresponding to the first rate matching manner is sequentially readingfrom a first bit to an M^(th) bit in the cyclic cache;

a bit reading order corresponding to the second rate matching manner issequentially and cyclically reading, starting from any location of thecyclic cache to an M^(th) bit in the cyclic cache in natural order or inreversed order.

In a possible design, a puncturing bit or a shortening bit indicated bythe first rate matching manner is in a first set, and a bit readingorder corresponding to the first rate matching manner is:

sequentially reading the encoded bits in the cyclic cache in naturalorder or in reversed order; and when a sequence number corresponding toa current bit is in the first set, skipping the current bit, andcontinuing with reading until a last bit is read; and

a bit reading order corresponding to the second rate matching manner issequentially and cyclically reading, starting from any location of thecyclic cache to an M^(th) bit in the cyclic cache in natural order or inreversed order.

In a possible design, the storage module is specifically configured to:

interleave, according to an interleaving manner corresponding to therate matching manner, on the encoded bits, to obtain interleaved bits,where the bit storage order corresponding to the rate matching manner isthe same as an order of the interleaved bits; and

bit collect on the interleaved bits, and store the interleaved bits intothe cyclic cache, wherein one or more bits are deleted from theinterleaved bits by puncturing in the bit collecting or wherein one ormore bits are deleted from the interleaved bits by shortening in the bitcollecting.

In a possible design, wherein the storage module is specificallyconfigured to: bit collect, according to the bit storage ordercorresponding to the rate matching manner, on the encoded bits, andstore the encoded bits into the cyclic cache, wherein one or more bitsare deleted from the encoded bits by puncturing in the bit collecting orone or more bits are deleted from the encoded bits by shortening in theencoded bits in the bit collecting, the bit storage order correspondingto the rate matching manner is natural order or reversed order.

In a possible design, wherein the bit reading order corresponding to thefirst rate matching manner is reading, in natural order, from a firstbit to a last bit in the cyclic cache, or reading, in reversed order,from a last bit to a first bit in the cyclic cache; and

a bit reading order corresponding to the second rate matching manner issequentially and cyclically reading M bits starting from any location inthe cyclic cache in natural order or in reversed order.

In a possible design, wherein the bit storage order comprise at leastone or a combination of the following:

the encoded bits are sorted in the cyclic cache in descending order, inascending order, in descending order after bit reversal, in ascendingorder after bit reversal, in descending order of reliability, inascending order of reliability, in random order, in ascending orderafter offset bit reversal, in descending order after offset bitreversal, or in an order corresponding to bitwise linear interleaving.

In a possible design, wherein the interleaving manner is used toindicate a quantity Rn of rows, a quantity Cn of columns, and row-columninterleaving or column-row interleaving, where both Rn and Cn areinteger powers of 2, and N=Rn×Cn; and

when the interleaving manner is the column-row interleaving, the bitstorage order is sorting, by row, encoded bits obtained after bitreversal and column interleaving, where each row of the encoded bits isused as a sub-segment, and the encoded bits obtained after bit reversaland column interleaving are encoded bits that are obtained after bitreversal and column interleaving;

a bit reading order corresponding to the first rate matching manner issequentially reading one bit from each sub-segment after bit reversaland row interleaving are performed on the encoded bits obtained afterbit reversal and column interleaving, until M bits are read; and a bitreading order corresponding to the second rate matching manner issequentially and cyclically reading, in natural order or in reversedorder by row and starting from any location in the encoded bits obtainedafter bit reversal and column interleaving, the encoded bits in thecyclic cache until M bits are read; or

when the interleaving manner is the row-column interleaving, the bitstorage order is sorting, by column, encoded bits obtained after bitreversal and row interleaving, where each column of the encoded bits isused as a sub-segment, and the encoded bits obtained after bit reversaland row interleaving are encoded bits that are obtained after bitreversal and row interleaving are performed on the encoded bits obtainedafter the polar encoding; and

a bit reading order corresponding to the first rate matching manner issequentially reading one bit from each sub-segment after bit reversaland column interleaving are performed on the encoded bits obtained afterbit reversal and row interleaving, until M bits are read; and a bitreading order corresponding to the second rate matching manner issequentially and cyclically reading, in natural order or in reversedorder by column and starting from any location in the encoded bitsobtained after bit reversal and row interleaving, the encoded bits inthe cyclic cache until M bits are read.

A fourth aspect of the embodiments of this application provides a devicefor polar code rate matching, including:

an encoding module, configured to polar encode according to a mothercode length N and a rate matching manner, to obtain encoded bits afterthe polar encoding, where the rate matching manner is one of a firstrate matching manner, a second rate matching manner, and a third ratematching manner, and N is a positive integer;

a storage module, configured to store, into a cyclic cache according toa bit storage order corresponding to the rate matching manner, theencoded bits, wherein the first rate matching manner, the second ratematching manner, and the third rate matching manner are corresponding toa same bit storage order; and

a reading module, configured to read, from the cyclic cache according toa bit reading order corresponding to the rate matching manner, an outputsequence obtained after rate matching, where at least two of the firstrate matching manner, the second rate matching manner, and the thirdrate matching manner are corresponding to different bit reading orders.

In a possible design, a length of the output sequence is a target codelength M, where M is an integer;

a target code length M corresponding to the first rate matching manneris less than the mother code length N;

a target code length M corresponding to the second rate matching manneris less than the mother code length N; and

a target code length M corresponding to the third rate matching manneris greater than the mother code length N.

In a possible design, wherein the first rate matching manner, the secondrate matching manner, and the third rate matching manner arecorresponding to different bit reading orders.

In a possible design, wherein the storage module is specificallyconfigured to:

interleave, according to an interleaving manner corresponding to therate matching manner, on the encoded bits obtained after the polarencoding, to obtain interleaved bits, wherein the bit storage order ofthe encoded bits is the same as an order of the interleaved bits; and

collect the interleaved bits, and storing the interleaved bits into thecyclic cache.

In a possible design, wherein the bit storage order comprises: a firststorage order and a second storage order, where the first rate matchingmanner is used to indicate the first storage order in advance, and thesecond rate matching manner is used to indicate the second storage orderin advance; and

wherein the first storage order is used to indicate a storage order, inthe cyclic cache, of first N/2 bits of the encoded bits, and the secondstorage order is used to indicate a storage order, in the cyclic cache,of last N/2 bits of the encoded bits; or

wherein the first storage order is used to indicate a storage order, inthe cyclic cache, of last N/2 bits of the encoded bits, and the secondstorage order is used to indicate a storage order, in the cyclic cache,of first N/2 bits of the encoded bits.

In a possible design, wherein the first storage order comprises at leastone or a combination of the following:

a descending order, an ascending order, a descending order ofreliability, an ascending order of reliability, a random order, an ordercorresponding to bitwise linear interleaving, and a reversed order of anorder corresponding to bitwise linear interleaving; and

wherein the second storage order comprises at least one or a combinationof the following:

a descending order, an ascending order, a descending order after bitreversal, an ascending order after bit reversal, a descending order ofreliability, an ascending order of reliability, a random order, anascending order after offset bit reversal, a descending order afteroffset bit reversal, an order corresponding to bitwise linearinterleaving, and a reversed order of an order corresponding to bitwiselinear interleaving.

In a possible design, when the first storage order is used to indicatethe storage order, in the cyclic cache, of the first N/2 bits of theencoded bits, and the second storage order is used to indicate thestorage order, in the cyclic cache, of the last N/2 bits of the encodedbits, a bit reading order corresponding to the first rate matchingmanner is sequentially reading from an (N−M+1)^(th) bit to an N^(th) bitin the cyclic cache, and a bit reading order corresponding to the secondrate matching manner is sequentially reading from a first bit to anM^(th) bit in the cyclic cache; or

when the first storage order is used to indicate the storage order, inthe cyclic cache, of the last N/2 bits of the encoded bits obtainedafter the polar encoding, and the second storage order is used toindicate the storage order, in the cyclic cache, of the first N/2 bitsof the encoded bits, a bit reading order corresponding to the first ratematching manner is sequentially reading from a first bit to an M^(th)bit in the cyclic cache, and a bit reading order corresponding to thesecond rate matching manner is sequentially reading an (N−M+1)^(th) bitto an N^(th) bit in the cyclic cache; and

a bit reading order corresponding to the third rate matching manner issequentially and cyclically reading, starting from any location and innatural order or in reversed order, the encoded bits in the cyclic cacheuntil M bits are read.

In a possible design, a sequence number of a puncturing bit in the firstrate matching manner is in a first set, and a sequence number of ashortening bit in the second rate matching manner is in a second set;

a bit reading order corresponding to the first rate matching manner is:sequentially reading the cyclic cache in natural order or in reversedorder; and when a sequence number corresponding to a current bit is inthe first set, skipping the current bit, and continuing with readinguntil a last bit is read;

a bit reading order corresponding to the second rate matching manner is:sequentially reading the cyclic cache in natural order or in reversedorder; and when a sequence number corresponding to a current bit is inthe second set, skipping the current bit, and continuing with readinguntil a last bit is read; and

a bit reading order corresponding to the third rate matching manner issequentially and cyclically reading, starting from any location and innatural order or in reversed order, the encoded bits in the cyclic cacheuntil M bits are read.

In a possible design, wherein the first rate matching manner and thesecond rate matching manner are corresponding to a same bit readingorder, and wherein the first rate matching manner and the third ratematching manner are corresponding to different bit reading orders.

In a possible design, wherein the storage module is specificallyconfigured to: interleave, according to an interleaving mannercorresponding to the rate matching manner, on the encoded bits, toobtain interleaved bits, wherein the bit storage order is the same as anorder of the interleaved bits; and

bit collect on the interleaved bits, and storing the interleaved bitsinto the cyclic cache, wherein one or more bits are deleted from theinterleaved bits by puncturing in the bit collecting or wherein one ormore bits are deleted from the interleaved bits by shortening in the bitcollecting.

In a possible design, wherein the storage module is specificallyconfigured to:

bit collect, according to the bit storage order corresponding to therate matching manner, on the encoded bits, and storing the encoded bitsinto the cyclic cache, wherein one or more bits are deleted from theencoded bits by puncturing in the bit collecting or one or more bits aredeleted from the encoded bits by shortening in the encoded bits in thebit collecting, the bit storage order corresponding to the rate matchingmanner is natural order or reversed order.

In a possible design, wherein the bit reading order corresponding to thefirst rate matching manner is reading, in natural order, from a firstbit to a last bit in the cyclic cache, or reading, in reversed order,from a last bit to a first bit in the cyclic cache; and

a bit reading order corresponding to the third rate matching manner issequentially and cyclically reading M bits, starting from any locationin the cyclic cache in natural order or in reversed order.

A fifth aspect of the embodiments of this application device for polarcode rate matching, including a memory and a processor. The memory isconfigured to store a program. The processor is configured to executethe program stored in the memory. When the program is executed, theprocessor is configured to perform the method according to any one ofthe first aspect and various implementations of the first aspect, or theprocessor is configured to perform the method according to any one ofthe second aspect and various implementations of the second aspect.

A sixth aspect of the embodiments of this application provides acomputer-readable storage medium, including an instruction. When runningon a computer, the instruction enables the computer to perform themethod according to any one of the first aspect and variousimplementations of the first aspect, or enables the computer to performthe method according to any one of the second aspect and variousimplementations of the second aspect.

A seventh aspect of the embodiments of this application provides acomputer program product. The computer program product includes computerprogram code. When running on a computer, the computer program codeenables the computer to perform the method according to any one of thefirst aspect and various implementations of the first aspect, or enablesthe computer to perform the method according to any one of the secondaspect and various implementations of the second aspect.

An eighth aspect of the embodiments of this application provides a chip,including a memory and a processor. The memory is configured to store acomputer program. The processor is configured to invoke, from thememory, and run the computer program, so that the processor performs themethod according to any one of the first aspect and variousimplementations of the first aspect, or the processor performs themethod according to any one of the second aspect and variousimplementations of the second aspect.

The embodiments of this application provide method and device for thepolar code rate matching. According to the method, the polar encoding isperformed according to the mother code length N and the rate matchingmanner, to obtain the encoded bits after the polar encoding. The ratematching manner is the first rate matching manner or the second ratematching manner. The encoded bits are stored into the cyclic cacheaccording to the bit storage order corresponding to the rate matchingmanner. The first rate matching manner and the second rate matchingmanner are corresponding to the same bit storage order, so that thefirst rate matching manner and the second rate matching manner arecorresponding to the same interleaving manner. One interleaver can beused to implement the two rate matching manners. When storage isperformed in natural order or in reversed order, the storage may bedirectly performed without an interleaver, thereby reducing the hardwarecomplexity and the area occupied by the hardware. The output sequenceobtained after rate matching is read from the cyclic cache according tothe bit reading order corresponding to the rate matching manner. Thefirst rate matching manner and the second rate matching manner arecorresponding to different bit reading orders, so that different outputsare implemented for different rate matching manners, and it is ensuredthat the encoder can output a correct output sequence to a decoder.

BRIEF DESCRIPTION OF DRAWINGS

FIG. 1 shows a basic network architecture in which embodiments of thisapplication may be applied;

FIG. 2 is a flowchart of a polar code rate matching process according toan embodiment of this application;

FIG. 3 is a flowchart of a polar code rate matching method according toan embodiment of this application;

FIG. 4 is a schematic diagram of a bit storage order according to anembodiment of this application;

FIG. 5 is a schematic diagram of a bit reading order according to anembodiment of this application;

FIG. 6 is a schematic diagram of row-column interleaving of encoded bitsaccording to an embodiment of this application;

FIG. 7 is a flowchart of a polar code rate matching method according toanother embodiment of this application;

FIG. 8 is an example of bit storage order according to an embodiment ofthis application;

FIG. 9 is a schematic diagram of a bit reading order according to anembodiment of this application;

FIG. 10 is another example of a bit storage order according to anembodiment of this application;

FIG. 11 is a schematic diagram of offset bit reversal according to anembodiment of this application;

FIG. 12 is another schematic diagram of bit reading order according toan embodiment of this application;

FIG. 13 is a block diagram of a polar code rate matching deviceaccording to an embodiment of this application; and

FIG. 14 is a structural diagram of a polar code rate matching deviceaccording to an embodiment of this application.

DESCRIPTION OF EMBODIMENTS

A network architecture and a service scenario that are described in theembodiments of this application are intended to illustrate technicalsolutions of the embodiments of this application more clearly, andconstitute no limitation on the technical solutions provided in theembodiments of this application. With evolution of the networkarchitecture and emergence of new service scenarios, the technicalsolutions provided in the embodiments of this application are alsoapplicable to similar technical problems.

The embodiments of this application may be applied to a scenario inwhich polar encoding is performed on information bits, and may beapplied to Wi-Fi, fourth generation (4G), fifth generation (5G), andfuture communications systems. FIG. 1 shows a basic network architecturein which embodiments of this application may be applied. As shown inFIG. 1, the network architecture includes a network device 01 and one ormore terminals 02. The terminal, as referred to in the description ofthis application, may include various devices with a wirelesscommunication function, such as handheld devices, in-vehicle devices,wearable devices, computing devices, other processing devices connectedto wireless modems, and terminal devices, mobile stations, and the likethat are in various forms. The network device, as referred to in thedescription of this application, is a device that is deployed on a radioaccess network and that is configured to provide a wirelesscommunication function for the terminal. The network device may be, forexample, a base station as shown in FIG. 1. The base station may includemacro base station, micro base station, relay station, access point, andthe like in various forms. A method provided in the embodiments of thisapplication may also be applied to other network devices that requireencoding, and the type of the network device is not limited.

In actual applications, information to be transmitted is encoded at thetransmitting end, and received encoded information is decoded at thereceiving end. For improving transmission efficiency, an encoder mayneed to perform rate matching after encoding, so as to obtain a polarcode of any code length through the rate matching. Correspondingly, adecoder needs to perform de-rate matching and decoding. When the networkdevice is the encoder, the corresponding terminal is the decoder; orwhen the terminal is the encoder, the corresponding network device isthe decoder.

For ease of understanding, the following introduces target code lengthand mother code length in polar encoding process.

Target code length is a length of an output sequence for transmission.The output sequence for transmission is obtained by performing ratematching on an encoded sequence, and the encoded sequence is obtained byperforming polar encoding on information bits. The target code length Mis determined according to at least one of a quantity K of theinformation bits, a bit rate R, an allocated resource, and channelquality. For example, M=INT(K/R), where INT(⋅) indicates rounding. Inthis embodiment, a specific manner of determining the target code lengthM is not particularly limited.

A mother code is a binary row vector. Some bits of the mother code areused to carry the information bits. Other bits are set to a fixed valuepre-agreed on between the encoder and the decoder, and are referred toas frozen bits. The value of the frozen bits may be set randomly, andare usually set to 0. The mother code length N may be determinedaccording to the target code length M. For example, N=min(2^(n),N_(max)), where n is a minimum integer that is greater than or equal tolog₂M. For example, N=min (2^(┌log 2) ^(M┐) , N_(max)), where min(⋅)indicates taking a minimum value, N_(max) is a maximum mother codelength supported by a system, and ┌⋅┐ indicates rounding up. The abovemerely provides a possible implementation example, and the mother codelength N may alternatively be determined by other manners.

The following describes three rate matching manners.

(1) Puncturing: Puncturing-based reconstruction, represented byquasi-uniform puncture (QUP), is one of encoding and rate matchingmanners for obtaining a polar coded sequence of any code length.Specifically, it is first determined that the mother code length is aninteger power of 2 that is greater than or equal to the target codelength, and then a puncturing location is determined according to themother code length and the target code length. A channel capacitycorresponding to a location of a punctured bit is set to 0 (or an errorprobability is set to 1, or a signal-to-noise ratio (SNR) is set to beinfinitely small). Reliabilities of polar channels are calculated byusing methods such as density evolution, Gaussian approximation, orlinear fitting, and the reliabilities are sorted, to determine locationsof information bits and frozen bits. During transmission, the encoderdeletes encoded bits in predetermined puncturing locations, to obtain arate-matched polar code sequence. During decoding, the bitscorresponding to the predetermined puncturing locations are treated asunknown bits, and a corresponding log-likelihood ratio (LLR) is set to0, and is used to restore the mother code length together with areceived LLR of non-puncturing locations, to implement de-rate matching.Then decoding is performed.

(2) Shortening: Similar to that in puncturing, it is determined that themother code length is an integer power of 2 that is greater than orequal to the target code length. A difference lies in that an encodedbit in a shortening location is related only to a frozen bit, the bit inthe shortening location is used as a known bit during decoding, and acorresponding LLR is set to be infinitely large. First, reliabilities ofpolar channels are calculated according to the mother code. Then,shortening locations are determined, and frozen bits are placed incorresponding polar channels. Finally, locations of information bits andthe frozen bits are determined in remaining polar channels according tothe reliabilities. During transmission, encoded bits in predeterminedshortening locations are deleted, to obtain a rate-matched polar codesequence. During decoding, the shortened bits are treated as known bits,and an LLR is set to be infinitely large, and is used to restore themother code length together with a received LLR of non-shortenedlocations, to implement de-rate matching. Then decoding is performed.

(3) Repetition: To balance encoding performance and complexity, amaximum value of the mother code length (an integer power of 2) may beset. Repetition is performed on a polar code obtained after encodingaccording to the maximum mother code length, to obtain a target codelength greater than the maximum mother code length and implement polarcode rate matching. Different from that in puncturing and shortening, inrepetition, bits that have been encoded into the maximum mother codelength are repeatedly sent in a particular order, until the target codelength is reached, thereby implementing a rate matching process. At thedecoder, LLRs of a same encoding location are combined to implementde-rate matching, and decoding is performed according to the maximummother code length.

Embodiment of this application provide a polar code rate matchingmethod, in order to resolve a technical problem that three sets ofhardware are required for the three rate matching manners. To bespecific, in the current technology solutions, three interleavers arerequired for respectively performing interleaving by using interleaverscorresponding to the three rate matching manners, and consequently,hardware implementation complexity is high, and a large area isoccupied.

FIG. 2 is a flowchart of a polar code rate matching process according toan embodiment of this application. A rate matching manner is selectedaccording to an encoding parameter. Polar encoding is performed, and aninformation bit stream is output. The information bit stream isinterleaved by using an interleaver, so that the information bit streamis sorted in a preset order. Bit collection is performed on aninformation bit stream in the preset order, and the information bitstream is sent to a cyclic cache. A bit selection method correspondingto the rate matching manner is selected, to obtain an output sequenceafter rate matching. According to the embodiment of FIG. 2, in thefollowing embodiments, an encoder simultaneously supports two or threerate matching manners, and only one interleaver is required forimplementation. The following describes, by using detailed embodiments,a cyclic cache-based hybrid polar code rate matching method provided inthe embodiments of this application.

FIG. 3 is a flowchart of a polar code rate matching method according toan embodiment of this application. The method provided in thisembodiment is applicable to the foregoing process of performing ratematching by the encoder. In this embodiment, an encoder supports tworate matching manners. For example, the two rate matching manners may beshortening and repetition, or may be puncturing and repetition.Shortening and puncturing may be used as one implementation, referred toas puncturing, shortening, or others. The method provided in thisembodiment includes the following steps.

Step 301: Polar encoding according to a mother code length N and a ratematching manner, to obtain encoded bits after the polar encoding, wherethe rate matching manner is a first rate matching manner or a secondrate matching manner.

In this embodiment, the first rate matching manner may be the puncturingor shortening, and the second rate matching manner may be therepetition.

When a target code length M is less than the mother code length N, theencoder may select the first rate matching manner. Whether the firstrate matching manner is specifically shortening or puncturing may bedetermined according to a bit rate. Specifically, a correspondencebetween the bit rate and shortening or puncturing may be pre-specifiedby using a protocol.

When a target code length M is greater than the mother code length N,the encoder selects the second rate matching manner.

In one encoding process, the encoder selects one rate matching mannerfor rate matching. After the rate matching manner is selected, polarencoding is performed according to the mother code length N and theselected rate matching manner. For a manner of determining the mothercode length, refer to the foregoing description.

Specifically, a polar code is constructed according to the mother codelength N, a quantity K of information bits, and the selected ratematching manner. Encoding is performed according to the constructedpolar code, to obtain an encoded bit sequence with a length of N.Herein, the polar code includes but is not limited to an Arikan polarcode, a PC-polar code, a CA-polar code, and a PC-CA-polar code. TheArikan polar code is a raw polar code that is not concatenated withother codes and that includes only information bits and frozen bits. ThePC-polar code is a polar code concatenated with parity check (PC). TheCA-polar code is a polar code concatenated with CRC or anotherconcatenated polar code. The PC-CA-polar code is a polar codeconcatenated with both PC and cyclic redundancy check (CRC). ThePC-polar code and the CA-polar code improve polar code performance byconcatenating different codes.

In constructing the polar code, if the rate-matching manner ispuncturing, the polar code is constructed according to puncturinglocations, or if the rate-matching manner is shortening, the polar codeis constructed according to shortening locations. Optionally, the polarcode may be constructed with reference to an interleaving manner, sothat puncturing locations or shortening locations that are obtainedafter interleaving processing are preset locations.

Step 302: Store, into a cyclic cache according to a bit storage ordercorresponding to the rate matching manner, the encoded bits, where thefirst rate matching manner and the second rate matching manner arecorresponding to a same bit storage order.

Step 303: Read, from the cyclic cache according to a bit reading ordercorresponding to the rate matching manner, an output sequence, where thefirst rate matching manner and the second rate matching manner arecorresponding to different bit reading orders.

In this embodiment, the first rate matching manner and the second ratematching manner are corresponding to a same bit storage order, and thebit storage order is determined according to an interleaving manner ofan interleaver. Therefore, the first rate matching manner and the secondrate matching manner are corresponding to a same interleaving manner,and the first rate matching manner and the second rate matching mannerin this embodiment can be implemented by using only one interleaver,without a need of a plurality of interleavers. In other words, theinterleaving manner and the bit storage order are the same regardless ofwhether the encoder selects the first rate matching manner or the secondrate matching manner. When the bit storage order is in natural order orin reversed order, the bit storage order can be directly implementedwithout using an interleaver.

Because the first rate matching manner and the second rate matchingmanner are corresponding to the same bit storage order, to implementdifferent outputs for different rate matching manners, the first ratematching manner and the second rate matching manner in this embodimentare corresponding to different bit reading orders. To be specific, anoutput sequence obtained after rate matching is read from the cycliccache according to a bit reading order corresponding to a selected ratematching manner. A process of reading, from the cyclic cache, the outputsequence obtained after rate matching is the bit selection process shownin FIG. 2. The bit reading order may be understood as a bit selectionorder.

The bit storage order and the bit reading order in this embodiment maybe implemented in the following possible implementations.

In a first implementation, interleaving processing is first performed onthe encoded bits, to obtain interleaved bits. A bit collection isperformed, and the interleaved bits are stored into a cyclic cache.Then, a bit selection is performed. If, in the interleaving process,puncturing bits are placed in the beginning of the interleaved bits,then in the puncturing, last M bits are read in the bit selectionprocess. If, in the interleaving process, shortening bits are placed inthe end of the interleaved bits, first M bits are read in the bitselection process. In the repetition, M bits are cyclically read,starting from any location.

Specifically, when the first rate matching manner is the puncturing, acorresponding bit reading order is sequentially reading from an(N−M+1)^(th) bit to an N^(th) bit in the cyclic cache, wherein a firstbit to an (N−M)^(th) bit are corresponding to the puncturing locations.Alternatively, when the first rate matching manner is the shortening, acorresponding bit reading order is sequentially reading from a first bitto an M^(th) bit in the cyclic cache, where an (M+1)^(th) bit to anN^(th) bit are corresponding to the shortening locations.

The second rate matching manner is the repetition, and a correspondingbit reading order is sequentially and cyclically reading, M bitsstarting from any location and in natural order or in reversed order.The any location may be determined according to an encoding parameter,or may be a fixed value, for example, an (N/4+1)^(th) bit. For readingin natural order, each time an N^(th) bit is read, reading cyclicallystarts from a first bit, until M bits are read. For the reversed order,each time a first bit is read, reading cyclically starts from an N^(th)bit, until M bits are read.

In a second implementation, interleaving is first performed on theencoded bits, to obtain interleaved bits; then bit collection isperformed, and the encoded bits are stored into the cyclic cache; andthen bit selection is performed. In this embodiment, in an interleavingprocess, a puncturing bit or a shortening bit may be set in anylocation. To improve interleaving efficiency, interleaving may beperformed in natural order or in reversed order. In a bit selectionprocess, the puncturing bit or the shortening bit only needs to beskipped. In this implementation, the interleaving implementation mayalternatively not be used; instead, a manner of performing storage innatural order or in reversed order may be used for implementation.

Specifically, a puncturing bit or a shortening bit in the first ratematching manner is in a first set. In a bit selection process, a bitreading order corresponding to the first rate matching manner is:sequentially reading the cyclic cache in natural order or in reversedorder; and when a sequence number corresponding to a current bit is inthe first set, skipping the current bit, and continuing with readinguntil a last bit is read. A bit reading order corresponding to thesecond rate matching manner is sequentially and cyclically reading Mbits starting from any location of the cyclic cache in natural order orin reversed order.

In a third implementation, interleaving processing is first performed onthe encoded bits, to obtain interleaved bits; and then bit collection isperformed, and the interleaved bits are stored into the cyclic cache. Inthis embodiment, in an interleaving process, a puncturing bit or ashortening bit may be set in any location. To improve interleavingefficiency, interleaving may be performed in natural order or inreversed order. In a bit collection process, the puncturing bit or theshortening bit is deleted, and all stored content is sequentially read.If there is no puncturing bit or shortening bit, no deletion operationneeds to be performed. In this implementation, the interleavingimplementation may alternatively not be used; instead, a manner ofperforming storage in natural order or in reversed order may be used forimplementation.

Specifically, when the first rate matching manner is the shortening orpuncturing, a corresponding bit reading order is reading, starting froma first bit in the cyclic cache, M bits in natural order, or reading,starting from a last bit in the cyclic cache, M bits in reversed order.Because the puncturing bit or the shortening bit has been deleted, Mbits can be read either in natural order or in reversed order.

When the second rate matching manner is the repetition, no bit needs tobe deleted, and a corresponding bit reading order is sequentially andcyclically reading, M bits starting from any location of the cycliccache in natural order or in reversed order in the cyclic cache.

In the foregoing implementations, the interleaving manner is used toindicate a processing process of the interleaver, so that an order ofthe interleaved bits is a preset order, namely, the bit storage order.In this embodiment, the bit storage order of the encoded bits in thecyclic cache includes at least one or a combination of the following:

-   -   in descending order,    -   in ascending order,    -   in descending order after bit reversal,    -   in ascending order after bit reversal,    -   in descending order of reliability,    -   in ascending order of reliability,    -   in random order,    -   in ascending order after offset bit reversal,    -   in descending order after offset bit reversal, and    -   in an order corresponding to bitwise linear interleaving.

The reliability is reliability of polar channels corresponding to thepolar code, and corresponding encoded bits are sorted similarly. Areliability measurement parameter used to represent the reliability maybe a polarization weight (PW) value, a Bhattacharya parameter, an errorprobability, a channel capacity, or the like. Bit reversal is:converting a decimal integer into a binary form, reversing an order ofbinary elements, and converting a binary number obtained after thereversing into a decimal number. The obtained new number is a bitreversal value of the original number. An order combination is acombination of the foregoing orders. For example, a first bit to an(N/2)^(th) bit are in any one of the foregoing orders, and an(N/2+1)^(th) bit to an N^(th) bit are in ascending order after bitreversal.

According to the polar code rate matching method provided in thisembodiment, the encoder performs polar encoding according to the mothercode length N and the rate matching manner, to obtain the encoded bitsafter the polar encoding, where the rate matching manner is the firstrate matching manner or the second rate matching manner. The encodedbits obtained after the polar encoding are stored into the cyclic cacheaccording to the bit storage order corresponding to the rate matchingmanner. The first rate matching manner and the second rate matchingmanner are corresponding to the same bit storage order, so that thefirst rate matching manner and the second rate matching manner arecorresponding to the same interleaving manner. One interleaver can beused to implement the two rate matching manners, or when storage isperformed in natural order or in reversed order, the storage may bedirectly performed without an interleaver, thereby reducing hardwarecomplexity and an area occupied by hardware. The encoder reads, from thecyclic cache according to the bit reading order corresponding to therate matching manner, the output sequence obtained after rate matching.The first rate matching manner and the second rate matching manner arecorresponding to different bit reading orders, so that different outputsare implemented for different rate matching manners, and it is ensuredthat the encoder can output a correct output sequence to a decoder.

The following describes several examples. In the following embodiments,the bit storage order and the bit reading order are described in detail.For other processes, refer to the foregoing embodiment. Details are notdescribed herein again in the embodiments.

In a specific example, the first rate matching manner is the puncturing,and the second rate matching manner is the repetition. The bit storageorder, in the cycle cache, of the encoded bits is that first N/4 encodedbits are sorted in ascending order, an (N/4+1)^(th) encoded bit to an(N/2+1)^(th) encoded bit are selected alternately, and an (N/2+1)^(th)encoded bit to an N^(th) encoded bit are sorted in natural order. Shownin FIG. 4 is a schematic diagram of a bit storage order according to anembodiment of this application.

0, 1, 2, . . . , and 15 are 16 bits in natural order, representingsequence numbers of locations of the encoded bits obtained after thepolar encoding. In a storage process, bits corresponding to 0, 1, 2, and3 are stored in natural order. A storage order of a bit corresponding to4 keeps unchanged. A storage location of a bit corresponding to 5changes from an original 6^(th) bit to a 7^(th) bit. A storage locationof a bit corresponding to 6 changes from an original 7^(th) bit to a9^(th) bit. For others, refer to FIG. 4. Details are not describedherein. The encoded bits are stored in the foregoing bit storage orderin both the puncture and the repetition.

For a bit selection process, according to a selected rate matchingscheme, a bit reading order is shown in FIG. 5. If the selected ratematching manner is puncturing, M bits are read from an (N−M+1)^(th) ofthe encoded bits to an N^(th) bit of the encoded bits in the cycliccache, and a puncturing start point is shown in FIG. 5. If the selectedrate matching manner is repetition, M bits in the cyclic cache aresequentially and cyclically read, starting from any location of thecyclic cache in natural order or in reversed order and a repetitionstart point is shown in FIG. 5.

In another specific example, the first rate matching manner is theshortening, and the second rate matching manner is the repetition. Theforegoing interleaving manner is used to indicate a quantity Rn of rows,a quantity Cn of columns, and row-column interleaving or column-rowinterleaving, where both Rn and Cn are integer powers of 2, and N=Rn×Cn.

If the interleaving manner indicates the column-row interleaving, thebit storage order is sorting, by row, encoded bits obtained after bitreversal and column interleaving, where each row of the encoded bits isused as a sub-segment. The encoded bits obtained after bit reversal andcolumn interleaving are encoded bits that are obtained after bitreversal and column interleaving are performed on the encoded bitsobtained after the polar encoding.

FIG. 6 is a schematic diagram of row-column interleaving of encoded bitsaccording to an embodiment of this application. As shown in FIG. 6, theencoded bits are written into the interleaver by row and are dividedinto four rows and eight columns. After bit reversal and columninterleaving are performed, an original 2^(nd) column (1, 9, 17, 25)changes to a 5^(th) column, and an original 4^(th) column (3, 11, 19,27) changes to a 7^(th) column. For others, refer to FIG. 6. Output ofthe interleaver is per-row output, to be specific, (0, 4, 2, 6, 1, 5, 3,7) are output. A corresponding bit storage order is per-row sorting andstorage, and to be specific, storage is performed according to theoutput of the interleaver.

If the selected rate matching manner is repetition, a bit reading orderis sequentially and cyclically reading, in natural order or in reversedorder by row and starting from any location in the encoded bits obtainedafter bit reversal and column interleaving, the encoded bits in thecyclic cache until M bits are read. The bit reading order is theforegoing per-row output order, to be specific, (0, 4, 2, 6, 1, 5, 3, 7,8, 12, 10, . . . ) are read.

If the selected rate matching manner is shortening, a bit reading orderis sequentially reading one bit from each sub-segment after bit reversaland row interleaving are performed on the encoded bits obtained afterbit reversal and column interleaving, until M bits are read. Fordetails, refer to FIG. 6. As shown in FIG. 6, after bit reversal and rowinterleaving are performed, an original 2^(nd) row (8, 12, . . . , 11,15) changes to a current 3^(rd) row, and an original 3^(rd) row changesto a current 2^(nd) row. In a reading process, one bit is sequentiallyread from each sub-segment, in other words, the bits are read percolumn. This embodiment provides an example in which first four bitsthat are read are (0, 16, 8, 24).

The interleaving manner may alternatively indicate the row-columninterleaving. In this case, the bit storage order is sorting, by column,encoded bits obtained after bit reversal and row interleaving. Eachcolumn of the encoded bits is used as a sub-segment, and the encodedbits obtained after bit reversal and row interleaving are encoded bitsthat are obtained after bit reversal and row interleaving are performedon the encoded bits obtained after the polar encoding. A bit readingorder corresponding to the first rate matching manner is sequentiallyreading one bit from each sub-segment after bit reversal and columninterleaving are performed on the encoded bits obtained after bitreversal and row interleaving, until M bits are read. A bit readingorder corresponding to the second rate matching manner is sequentiallyand cyclically reading, in natural order or in reversed order by columnand starting from any location in the encoded bits obtained after bitreversal and row interleaving, the encoded bits in the cyclic cacheuntil M bits are read. A specific implementation is similar to thecolumn-row interleaving. Details are not described herein again in thisembodiment.

In still another specific example, the first rate matching manner is theshortening or puncturing, and the second rate matching manner is therepetition.

If the selected rate matching manner is the shortening or puncturing, abit reading order is sequentially reading the cyclic cache in naturalorder or in reversed order. When a sequence number, obtained after bitreversal, corresponding to a current sequence number (starting from 0)is greater than or equal to the target code length M, current bit isskipped. For example, if the mother code length is 16 and the targetcode length is 12, a 4^(th) bit (whose sequence number is 3, where asequence number, obtained after bit reversal, corresponding to 3 is 12)is skipped during reading, to implement shortening or puncturing of acode length. The sequence number, obtained after bit reversal,corresponding to the current sequence number is an implementation of thefirst set.

If the selected rate matching manner is repetition, a bit reading ordercorresponding to the second rate matching manner is: sequentially andcyclically reading, M bits starting from any location of the cycliccache in natural order or in reversed order in the cyclic cache Areading manner is similar to the foregoing reading manner forrepetition. Details are not described herein again in this embodiment.

The foregoing disclosure describes, by using examples, implementationsin which the interleaver supports two rate matching manners. In aspecific implementation process, the bit storage order and the bitreading order may be implemented in another manner. Details are notdescribed herein in this embodiment. The following describes, by usingan example, an implementation in which an interleaver supports threerate matching manners.

FIG. 7 is a flowchart of a polar code rate matching method according toan embodiment of this application. The method provided in thisembodiment is applicable to the foregoing process of performing ratematching by the encoder. In this embodiment, an encoder supports threerate matching manners, which are specifically rate matching mannersrespectively corresponding to shortening, puncturing, and repetition.The method provided in this embodiment includes the following steps.

Step 701: Polar encoding according to a mother code length N and a ratematching manner, to obtain encoded bits after the polar encoding, wherethe rate matching manner is one of a first rate matching manner, asecond rate matching manner, and a third rate matching manner.

Step 702: Store, into a cyclic cache according to a bit storage ordercorresponding to the rate matching manner, the encoded bits, where thefirst rate matching manner, the second rate matching manner, and thethird rate matching manner are corresponding to a same bit storageorder.

Step 703: Read, from the cyclic cache according to a bit reading ordercorresponding to the rate matching manner, an output sequence obtainedafter rate matching, wherein at least two of the first rate matchingmanner, the second rate matching manner, and the third rate matchingmanner are corresponding to different bit reading orders.

An implementation of this embodiment is similar to the embodiment shownin FIG. 3. For similar parts, refer to the descriptions of theembodiment in FIG. 3. Details are not described herein again. Adifference of the implementation of this embodiment from the embodimentshown in FIG. 3 lies in that the encoder supports three rate matchingmanners in this embodiment. Specifically, the first rate matching manneris puncturing, and a corresponding target code length M is less than themother code length N. The second rate matching manner is shortening, anda corresponding target code length M is less than the mother code lengthN. The third rate matching manner is repetition, and a correspondingtarget code length M is greater than the mother code length N.

In this embodiment, likewise, there are correspondingly three possibleimplementations. Details are as follows.

In a first implementation, interleaving is first performed on theencoded bits, to obtain interleaved bits; then bit collection isperformed, and the encoded bits are stored into the cyclic cache; andthen bit selection is performed. In an interleaving, two factors need tobe considered for interleaving: puncturing and shortening. To bespecific, interleaving is determined by using a puncturing bit and ashortening bit together. A first bit is set as the puncturing bit, and alast bit is set as the shortening bit. In a bit selection, last M bitsare read in the puncturing, first M bits are read in the shortening, andM bits are cyclically read starting from any location in the repetition.

Specifically, the bit storage order in this embodiment includes a firststorage order and a second storage order, where the first rate matchingmanner is used to indicate the first storage order in advance, and thesecond rate matching manner is used to indicate the second storage orderin advance. The first rate matching manner may be the puncturing, andthe second rate matching manner may be the shortening.

The first storage order is used to indicate a storage order, in thecyclic cache, of first N/2 bits of the encoded bits, and the secondstorage order is used to indicate a storage order, in the cyclic cache,of last N/2 bits of the encoded bits.

Alternatively, the first storage order is used to indicate a storageorder, in the cyclic cache, of last N/2 bits of the encoded bits, andthe second storage order is used to indicate a storage order, in thecyclic cache, of first N/2 bits of the encoded bits.

The first storage order includes at least one or a combination of thefollowing:

-   -   a descending order,    -   an ascending order,    -   a descending order of reliability,    -   an ascending order of reliability,    -   a random order,    -   an order corresponding to bitwise linear interleaving, and    -   a reversed order of an order corresponding to bitwise linear        interleaving.

The second storage order includes at least one or a combination of thefollowing:

-   -   a descending order,    -   an ascending order,    -   a descending order after bit reversal,    -   an ascending order after bit reversal,    -   a descending order of reliability,    -   an ascending order of reliability,    -   a random order,    -   an ascending order after offset bit reversal,    -   a descending order after offset bit reversal,    -   an order corresponding to bitwise linear interleaving, and    -   a reversed order of an order corresponding to bitwise linear        interleaving.

To sum up, the puncturing, the shortening, and the repetition providedin this embodiment of this application are corresponding to a same bitstorage order, but the bit storage order is determined according to afull consideration of two factors: puncturing and shortening.

To implement different output sequences for different rate matchingmanners, the first rate matching manner, the second rate matchingmanner, and the third rate matching manner in this embodiment arecorresponding to different bit reading orders. To be specific, an outputsequence obtained after rate matching is read from the cyclic cacheaccording to a bit reading order corresponding to a selected ratematching manner.

For example, in the cyclic cache, the first storage order is used forthe first N/2 bits of the encoded bits, and the second storage order isused for the last N/2 bits of the encoded bits. A bit reading ordercorresponding to the puncturing is sequentially reading M bits from an(N−M+1)^(th) bit to an N^(th) bit (wherein the puncturing bits are froma first bit to an (N−M)^(th) bit) in the cyclic cache. A bit readingorder corresponding to the shortening is sequentially reading M bitsfrom a first bit to an M^(th) bit (wherein the shortening bits are froman (M+1)^(th) bit to an N^(th) bit) in the cyclic cache. For anotherexample, in the cyclic cache, the first storage order is used for thelast N/2 bits of the encoded bits, and the second storage order is usedfor the first N/2 bits of the encoded bits. A bit reading ordercorresponding to the puncturing is sequentially reading from a first bitto an M^(th) bit (wherein the puncturing bits are from an (M+1)^(th) bitto an N^(th) bit) in the cyclic cache. A bit reading order correspondingto the shortening is sequentially reading from an (N−M+1)^(th) bit to anN^(th) bit (wherein the shortening bits are from a first bit to an(N−M)^(th) bit) in the cyclic cache. A bit reading order correspondingto the repetition is sequentially and cyclically reading, starting fromany location and in natural order or in reversed order, the encoded bitsin the cyclic cache, until M bits are read.

In the following two examples, descriptions are provided assuming thatthe first rate matching manner is the puncturing, and the second ratematching manner is the shortening. The first storage order is for thefirst N/2 bits of the encoded bits, and the second storage order is forthe last N/2 bits of the encoded bits. A case in which the first storageorder is for the last N/2 bits of the encoded bits, and the secondstorage order is for the first N/2 bits of the encoded bits is similar.Details are not described herein.

In a first example, the bit storage order may be implemented bysegmented interleaving. As shown in FIG. 8, bit reversal is performed on(0, 1, 2, 3, 4, 5, 6, 7) that are sorted in natural order, to obtain (0,4, 2, 6, 1, 5, 3, 7). The second storage order is that a storage orderof an (N/2+1)^(th) bit to an N^(th) bit, wherein the storage order of an(N/2+1)^(th) bit to an N^(th) bit is from an (N/2+1)^(th) bit to anN^(th) bit that are obtained after bit reversal. This is designed forshortening. The first storage order is that remaining bits, namely, bitsin odd locations, are sorted in natural order. This is designed forpuncturing.

FIG. 9 is a schematic diagram of bit reading order according to anembodiment of this application. As shown in FIG. 9, a bit length of theencoded bits is N. FIG. 9 shows a puncturing start point, a shorteningstart point, and a repetition start point. A bit reading ordercorresponding to the puncturing is sequentially reading M bits from an(N−M+1)^(th) bit (the puncturing start point) to an N^(th) bit in thecyclic cache. A bit reading order corresponding to the shortening issequentially reading M bits from a first bit (the shortening startpoint) to an M^(th) bit in the cyclic cache. A bit reading ordercorresponding to the repetition is sequentially and cyclically reading Mbits starting from any location of the cyclic cache in natural order orin reversed order in the cyclic cache.

The interleaving manner is the same regardless of whether the ratematching manner initially selected by the encoder is the puncturing, theshortening, or the repetition. An order of the interleaved bits, namely,the bit storage order, is shown in FIG. 8. In a reading process, a bitreading order corresponding to the initially selected rate matchingmanner is selected according to the foregoing bit reading order, toperform reading.

In the example shown in FIG. 9, if the first storage order is used forthe last N/2 bits of the encoded bits, and the second storage order isused for the first N/2 bits of the encoded bits, an order of the firstN/2 bits is equivalent to a reversed order of last N/2 bits shown inFIG. 9, and an order of the last N/2 bits is equivalent to a reversedorder of first N/2 bits shown in FIG. 9. The bit storage order is 7, 3,5, 1, 6, 4, 2, 0. When reading is performed in reversed order, contentobtained by reading is the same as that in FIG. 9.

In a second example, the bit storage order may be implemented bysegmented interleaving. As shown in FIG. 10, the first storage order isthat: the first bit to the (N/8)^(th) bit are stored in a natural order,the (N/8+1)^(th) bit to the (3N/8)^(th) bit are stored according to anorder obtained after a bitwise linear interleaving is performed betweenthe (N/8+1)^(th) bit to an the (N/4)^(th) bit and the (N/4+1)^(th) bitto the (3N/8)^(th) bit, and the (3N/8+1)^(th) bit to the (N/2)^(th) bitare stored in natural order. The second storage order is that an(N/2+1)^(th) bit to an N^(th) bit are sorted in an order obtained afteroffset bit reversal. The order obtained after offset bit reversal isobtained by subtracting an offset value from a sequence in natural orderwhose first bit is not 1, performing bit reversal on an offset sequence,and adding the offset value. FIG. 11 is a schematic diagram of offsetbit reversal according to an embodiment of this application.

Bit reading orders of rate matching manners in this embodiment aresimilar to those in FIG. 9 in the foregoing example. Details are notdescribed herein again in this embodiment.

In a second implementation, interleaving processing is first performedon the encoded bits, to obtain interleaved bits; then bit collection isperformed, and the interleaved bits are stored into the cyclic cache;and then bit selection is performed. In this embodiment, in aninterleaving process, a puncturing bit or a shortening bit may be set inany location of the interleaved bits. To improve interleavingefficiency, interleaving may be performed in natural order or inreversed order. In a bit selection process, the puncturing bit or theshortening bit only needs to be skipped. In this implementation, theinterleaving implementation may alternatively not be used; instead, amanner of performing storage in natural order or in reversed order maybe used for implementation.

Specifically, a sequence number of a puncturing bit in the first ratematching manner is recorded in a first set, and a sequence number of ashortening bit in the second rate matching manner is recorded in asecond set. FIG. 12 is yet another schematic diagram of a bit readingorder according to an embodiment of this application. As shown in FIG.12, in a reading process, a bit reading order corresponding to the firstrate matching manner is that the cyclic cache is sequentially read innatural order or in reversed order. When a sequence number correspondingto a current bit is in the first set, the current bit is skipped and thereading continues until a last bit is read. A bit reading ordercorresponding to the second rate matching manner is: sequentiallyreading the cyclic cache in natural order or in reversed order; and whena sequence number corresponding to a current bit is in the second set,skipping the current bit, and continuing with reading until a last bitis read. A bit reading order corresponding to the third rate matchingmanner is sequentially and cyclically reading, starting from anylocation of the cyclic cache in natural order or in reversed order, theencoded bits in the cyclic cache, until M bits are read.

In a third implementation, interleaving processing is first performed onthe encoded bits, to obtain interleaved bits; and then bit collection isperformed, and the interleaved bits are stored into the cyclic cache. Inthis embodiment, in an interleaving process, a puncturing bit or ashortening bit may be set in any location of the interleaved bits. Toimprove interleaving efficiency, interleaving may be performed innatural order or in reversed order. In a bit collection process, thepuncturing bit or the shortening bit is deleted, none of stored bitsinclude the puncturing bit or the shortening bit, and the stored bitsare sequentially read. If there is no puncturing bit or shortening bit,no deletion operation needs to be performed. In this implementation, theinterleaving implementation may alternatively not be used. Instead, amanner of performing storage in natural order or in reversed order maybe used for implementation.

In this case, the first rate matching manner and the second ratematching manner are corresponding to a same bit reading order: reading,starting from a first bit in the cyclic cache, M bits in natural order,or reading, starting from a last bit in the cyclic cache, M bits inreversed order A bit reading order corresponding to the third ratematching manner is sequentially and cyclically reading, starting fromany location and in natural order or in reversed order, the encoded bitsin the cyclic cache, until M bits are read.

In the second implementation and the third implementation, the firstrate matching manner and the second rate matching manner may arecorresponding to two bit storage orders, as described in the foregoingembodiment, or may are corresponding to the same one bit storage order.In a specific implementation process, different rate matching mannershave the same one bit storage order, different bit storage orders may beimplemented by using different interleaving manners. The bit storageorder of the encoded bits in the cyclic cache includes at least one or acombination of the following:

-   -   in descending order,    -   in ascending order,    -   in descending order after bit reversal,    -   in ascending order after bit reversal,    -   in descending order of reliability,    -   in ascending order of reliability,    -   in random order,    -   in ascending order after offset bit reversal,    -   in descending order after offset bit reversal, and    -   in an order corresponding to bitwise linear interleaving.

According to the polar code rate matching method provided in thisembodiment, the encoder performs polar encoding according to the mothercode length N and the rate matching manner, to obtain the encoded bitsafter the polar encoding. The rate matching manner is one of the firstrate matching manner, the second rate matching manner, and the thirdrate matching manner. The encoded bits are stored into the cyclic cacheaccording to the bit storage order corresponding to the rate matchingmanner. The first rate matching manner, the second rate matching manner,and the third rate matching manner are corresponding to the same bitstorage order, so that the first rate matching manner, the second ratematching manner, and the third rate matching manner are corresponding toa same interleaving order. One interleaver can be used to implement thethree rate matching manners, thereby reducing hardware complexity and anarea occupied by hardware. The encoder reads, from the cyclic cacheaccording to the bit reading order corresponding to the rate matchingmanner, the output sequence obtained after rate matching. At least twoof the first rate matching manner, the second rate matching manner, andthe third rate matching manner are corresponding to different bitreading orders, so that different outputs are implemented for differentrate matching manners, and it is ensured that the encoder can output acorrect output sequence to a decoder.

An embodiment of this application further provides a method for polarcode rate matching. According to the method, a storage order of encodedbits in a cyclic cache may be implemented according to a rate matchingmanner and by inserting an interleaving process between polar codeencoding output and the cyclic cache.

Specifically, if a puncturing is used, no interleaving is performed, andencoded bits are directly input into the cyclic cache. If a shorteningis used, bit reversal and interleaving are performed, and interleavedbits are input into the cyclic cache. If a repetition is used, nointerleaving is performed, and encoded bits are directly input into thecyclic cache. In other words, three rate matching manners can besupported by using one interleaver, thereby reducing hardware complexityand a hardware area.

At a decoder, for decoding manners for the puncturing, the shortening,and the repetition, refer to the decoding manners in the descriptions ofthe three rate matching manners in the foregoing embodiments.

The implementations or examples provided in the foregoing embodimentsare implementations provided for understanding the embodiments of thisapplication, and may be combined, used as references, or implementedindependently in a specific implementation process. Specificimplementations are not particularly limited herein in this embodiment.

The foregoing mainly describes the solutions provided in the embodimentsof this application from a perspective of an encoder. It may beunderstood that to implement the foregoing functions, the encoderincludes corresponding hardware structures and/or software modules forexecuting the functions. With reference to units and algorithm steps ofexamples described in embodiments that are disclosed in the embodimentsof this application, the embodiments of this application may beimplemented by hardware, or a combination of hardware and computersoftware. Whether a function is executed by the hardware or by thecomputer software driving the hardware depends on particularapplications and design constraint conditions of the technicalsolutions. Different methods may be used to implement the describedfunctions for each particular application, but it should not beconsidered that the implementation goes beyond the scope of thetechnical solutions of the embodiments of this application.

The embodiments further provide a polar code rate matching device, wherethe rate matching device may be a foregoing network device used as anencoder, or may be the foregoing terminal used as an encoder.

FIG. 13 is a block diagram of a polar code rate matching deviceaccording to an embodiment of this application. As shown in FIG. 13, thedevice 1300 includes an encoding module 1301, a storage module 1302, anda reading module 1303. The encoding module 1301 is configured to performpolar encoding according to a mother code length N and a rate matchingmanner, to obtain encoded bits after the polar encoding, where the ratematching manner is one of a first rate matching manner, a second ratematching manner, and a third rate matching manner, and N is a positiveinteger. The storage module 1302 is configured to store, into a cycliccache according to a bit storage order corresponding to the ratematching manner, the encoded bits obtained after the polar encoding,where the first rate matching manner, the second rate matching manner,and the third rate matching manner are corresponding to a same bitstorage order. The reading module 1303 is configured to read, from thecyclic cache according to a bit reading order corresponding to the ratematching manner, an output sequence obtained after rate matching, whereat least two of the first rate matching manner, the second rate matchingmanner, and the third rate matching manner are corresponding todifferent bit reading orders.

Optionally, a length of the output sequence is a target code length M,where M is an integer. A target code length M corresponding to the firstrate matching manner is less than the mother code length N. A targetcode length M corresponding to the second rate matching manner is lessthan the mother code length N. A target code length M corresponding tothe third rate matching manner is greater than the mother code length N.

Optionally, the first rate matching manner, the second rate matchingmanner, and the third rate matching manner are corresponding todifferent bit reading orders.

Optionally, the storage module 1302 is specifically configured to:interleaving, according to an interleaving manner corresponding to therate matching manner, on the encoded bits, to obtain interleaved bits,wherein the bit storage order is the same as an order of the interleavedbits; and bit collect on the interleaved bits, and store the interleavedbits into the cyclic cache.

Optionally, the bit storage order includes a first storage order and asecond storage order, wherein the first storage order is pre-configuredaccording to the first rate matching manner, and wherein the secondstorage order is pre-configured according to the second rate matchingmanner. The first storage order in the cyclic cache, is a storage orderof first N/2 bits of the encoded bits in the cyclic cache, and thesecond storage order is a storage order, of last N/2 bits of the encodedbits in the cyclic cache. The first storage order is a storage order oflast N/2 bits of the encoded bits in the cyclic cache, and the secondstorage order is a storage order, of first N/2 bits of the encoded bitsin the cyclic cache.

Optionally, the first storage order includes at least one or acombination of the following:

-   -   a descending order, an ascending order,    -   a descending order of reliability,    -   an ascending order of reliability,    -   a random order,    -   an order corresponding to bitwise linear interleaving, and    -   a reversed order of an order corresponding to bitwise linear        interleaving.

The second storage order includes at least one or a combination of thefollowing:

-   -   a descending order,    -   an ascending order,    -   a descending order after bit reversal,    -   an ascending order after bit reversal,    -   a descending order of reliability,    -   an ascending order of reliability,    -   a random order,    -   an ascending order after offset bit reversal,    -   a descending order after offset bit reversal,    -   an order corresponding to bitwise linear interleaving, and    -   a reversed order of an order corresponding to bitwise linear        interleaving.

Optionally, when the first storage order is the storage order of thefirst N/2 bits of the encoded bits in the cyclic cache, and the secondstorage order is used for the last N/2 bits of the encoded bits obtainedafter the polar encoding, a bit reading order corresponding to the firstrate matching manner is sequentially reading an (N−M+1)^(th) bit to anN^(th) bit in the cyclic cache, and a bit reading order corresponding tothe second rate matching manner is sequentially reading a first bit toan M^(th) bit in the cyclic cache. If the first storage order is usedfor the last N/2 bits of the encoded bits obtained after the polarencoding, and the second storage order is for the first N/2 bits of theencoded bits obtained after the polar encoding, a bit reading ordercorresponding to the first rate matching manner is sequentially readinga first bit to an M^(th) bit in the cyclic cache, and a bit readingorder corresponding to the second rate matching manner is sequentiallyreading an (N−M+1)^(th) bit to an N^(th) bit in the cyclic cache. A bitreading order corresponding to the third rate matching manner issequentially and cyclically reading, starting from any location and innatural order or in reversed order, the encoded bits in the cyclic cacheuntil M bits are read.

Optionally, a sequence number of a puncturing bit in the first ratematching manner is in a first set, and a sequence number of a shorteningbit in the second rate matching manner is in a second set. A bit readingorder corresponding to the first rate matching manner is: sequentiallyreading the cyclic cache in natural order or in reversed order; and whena sequence number corresponding to a current bit is in the first set,skipping the current bit, and continuing with reading until a last bitis read A bit reading order corresponding to the second rate matchingmanner is: sequentially reading the cyclic cache in natural order or inreversed order; and when a sequence number corresponding to a currentbit is in the second set, skipping the current bit, and continuing withreading until a last bit is read. A bit reading order corresponding tothe third rate matching manner is: sequentially and cyclically reading,starting from any location and in natural order or in reversed order,the encoded bits in the cyclic cache until M bits are read.

Optionally, the first rate matching manner and the second rate matchingmanner are corresponding to a same bit reading order, and the first ratematching manner and the third rate matching manner are corresponding todifferent bit reading orders.

Optionally, the storage module 1302 is specifically configured to:

perform, according to an interleaving manner corresponding to the ratematching manner, interleaving processing on the encoded bits obtainedafter the polar encoding, to obtain interleaved bits, where the bitstorage order is the same as an order of the interleaved bits; and

perform bit collection on the interleaved bits, and store theinterleaved bits into the cyclic cache, where a puncturing bit or ashortening bit in the interleaved bits is deleted in a bit collectionprocess.

Optionally, the interleaving manner is used to indicate a quantity Rn ofrows, a quantity Cn of columns, and row-column interleaving orcolumn-row interleaving. Both Rn and Cn are integer powers of 2, andN=Rn×Cn. If the interleaving manner indicates the column-rowinterleaving, the bit storage order is sorting, by row, encoded bitsobtained after bit reversal and column interleaving. Each row of theencoded bits is used as a sub-segment, and the encoded bits obtainedafter bit reversal and column interleaving are encoded bits that areobtained after bit reversal and column interleaving are performed on theencoded bits obtained after the polar encoding.

Optionally, the storage module 1302 is specifically configured to:perform, according to the bit storage order corresponding to the ratematching manner, bit collection on the encoded bits, and store theencoded bits into the cyclic cache. A puncturing bit or a shortening bitin the encoded bits is deleted in a bit collection process, and the bitstorage order is performing storage in natural order or in reversedorder.

Optionally, a bit reading order corresponding to the first rate matchingmanner is reading, in natural order, a first bit to a last bit in thecyclic cache, or reading, in reversed order, a last bit to a first bitin the cyclic cache. A bit reading order corresponding to the third ratematching manner is sequentially and cyclically reading, M encoded bitsstarting from any location and in natural order or in reversed order, inthe cyclic cache.

The rate matching device provided in this embodiment is configured toperform the method embodiments shown in FIG. 3 and FIG. 7.Implementation principles and technical effects thereof are similar, anddetails are not described herein again in this embodiment.

FIG. 14 is a structural diagram of a device for polar code rate matchingaccording to an embodiment of this application. The rate matching device1400 may be a communications device such as the foregoing network deviceor terminal, or a chip, or the like. As shown in FIG. 14, the ratematching device 1400 may be implemented by using a bus 1401 as a generalbus system structure. According to specific applications and overalldesign constraint conditions of the rate matching device 1400, the bus1401 may include any quantity of interconnection buses and bridges. Thebus 1401 connects various circuits together. These circuits include aprocessor 1402, a storage medium 1403, and a bus interface 1404.Optionally, the rate matching device 1400 connects a network adapter1405 and the like through the bus 1401 by using the bus interface 1404.The network adapter 1405 may be configured to implement a signalprocessing function at a physical layer on a wireless communicationsnetwork, and implement sending and receiving of radio frequency signalsby using an antenna 1407. A user interface 1406 may be connected to auser terminal such as a keyboard, a display, a mouse, or a joystick. Thebus 1401 may be further connected to other circuits such as a timingsource, a peripheral device, a voltage regulator, and a power managementcircuit. These circuits are well-known in the art, and therefore detailsare not described.

Alternatively, the rate matching device 1400 may be configured as ageneral-purpose processing system, for example, generally referred to asa chip. The general-purpose processing system includes: one or moremicroprocessors that provide a processor function, and an externalmemory that provides at least a part of a storage medium 1503. All theseare connected to other support circuits by using an external bus systemstructure.

Alternatively, the rate matching device 1400 may be implemented by usingthe following: an application-specific integrated circuit (ASIC) thathas the processor 1402, the bus interface 1404, and the user interface1406; and at least a part of the storage medium 1403 integrated in asingle chip. Alternatively, the rate matching device 1400 may beimplemented by using the following: one or more field-programmable gatearrays (FPGA), a programmable logic device (PLD), a controller, a statemachine, gate logic, a discrete hardware component, any otherappropriate circuits, or any combination of circuits that can executefunctions described throughout the embodiments of this application.

The processor 1402 is responsible for bus management and generalprocessing (including executing software stored in the storage medium1403). The processor 1402 may be implemented by using one or moregeneral-purpose processors and/or dedicated processors. Examples of theprocessor include a microprocessor, a micro controller, a DSP, and othercircuits that can execute software. The software should be generallyexplained as representing an instruction, data, or any combinationthereof, regardless of whether the software is referred to as software,firmware, middleware, microcode, a hardware description language, orothers.

As shown in FIG. 14, the storage medium 1403 is separated from theprocessor 1402. However, it can easily be figured out that the storagemedium 1403 or any part of the storage medium 1403 may be locatedoutside the rate matching device 1400. For example, the storage medium1403 may include a transmission line, a carrier waveform modulated byusing data, and/or a computer artifact separated from a wireless node.All these media can be accessed by the processor 1402 by using the businterface 1404. Alternatively, the storage medium 1403 or any part ofthe storage medium 1403 may be integrated into the processor 1402. Forexample, the storage medium 1403 may be a cache and/or a general-purposeregister.

The processor 1402 may execute the foregoing embodiments, for example,the foregoing embodiments sequentially corresponding to FIG. 2 to FIG.12. An execution process of the processor 1402 is not described indetail herein.

The foregoing encoding module, storage module, and reading module may beimplemented as a processor.

An embodiment of this application further provides a computer programproduct. The computer program product includes computer program code.When running on a computer, the computer program code enables thecomputer to perform the polar code rate matching method in the foregoingembodiments.

An embodiment of this application provides a chip, including a memoryand a processor. The memory is configured to store a computer program.The processor is configured to invoke, from the memory, and run thecomputer program, so that the processor performs the polar code ratematching method in the foregoing embodiments.

What is claimed is:
 1. A method for use in a wireless communicationnetwork, comprising: obtaining, by a communication device, K informationbits, wherein K≥1; generating, by the communication device, ato-be-encoded sequence having a length of N bits, wherein theto-be-encoded sequence comprises the K information bits and L frozenbits, wherein L is larger than or equal to (N−M), N is an integer powerof 2, and M is a positive integer and less than N; and wherein L bitpositions of the to-be-encoded sequence for placing the L frozen bitsare determined according to a rate match manner; polar encoding, by thecommunication device, the to-be-encoded sequence, to obtain an encodedsequence; interleaving, by the communication device, the encodedsequence, to obtain an interleaved sequence; sequentially storing, bythe communication device, the interleaved sequence into a cyclic cacheof the communication device; and sequentially outputting, by thecommunication device, M bits of the interleaved sequence from the cycliccache according to the rate matching manner.
 2. The method according toclaim 1, wherein the rate matching manner is puncturing, and the(N−M+1)^(th) bit to the N^(th) bit of the interleaved sequence areoutput from the cyclic cache.
 3. The method according to claim 1,wherein the rate matching manner is shortening, and the first bit to theM^(th) bit of the interleaved sequence are output from the cyclic cache.4. The method according to claim 1, wherein polar encoding theto-be-encoded sequence to obtain the encoded sequence comprises:generating a binary row vector u₁ ^(N)=(u₁, u₂, K, u_(N)), wherein thebinary row vector corresponds to the to be encoded sequence; andencoding the binary row vector u₁ ^(N) according an encoding formula, toobtain the encoded bit sequence; wherein the encoding formula is:x ₁ ^(N) =u ₁ ^(N) G _(N), wherein x₁ ^(N)=(x₁, x₂, . . . , x_(N)) isthe encoded bit sequence, and G_(N) is a polar code generating matrix ofN rows and N columns.
 5. A device in a wireless communication network,comprising a processor, a cyclic cache, and a memory storing programinstructions for execution by the processor; wherein when executed bythe processor, the program instructions cause the device to: obtain Kinformation bits, wherein K≥1; generate a to-be-encoded sequence havinga length of N bits, wherein the to-be-encoded sequence comprises the Kinformation bits and L frozen bits, wherein L is larger than or equal to(N−M), N is an integer power of 2, and M is a positive integer and lessthan N; and wherein L bit positions of the to-be-encoded sequence forplacing the L frozen bits are determined according to a rate matchmanner; polar encode the to-be-encoded sequence, to obtain an encodedsequence; interleave the encoded sequence, to obtain an interleavedsequence; sequentially store the interleaved sequence into a cycliccache of the communication device; and sequentially output M bits of theinterleaved sequence from the cyclic cache according to the ratematching manner.
 6. The device according to claim 5, wherein the ratematching manner is puncturing, and the (N−M+1)^(th) bit to the N^(th)bit of the interleaved sequence are output from the cyclic cache.
 7. Thedevice according to claim 5, wherein the rate matching manner isshortening, and the first bit to the M^(th) bit of the interleavedsequence are output from the cyclic cache.
 8. The device according toclaim 5, wherein in polar encoding the to-be-encoded sequence to obtainthe encoded sequence, by executing the program instructions, theprocessor is configured to: generating a binary row vector u₁ ^(N)=(u₁,u₂, K, u_(N)), wherein the binary row vector corresponds to the to beencoded sequence; and encoding the binary row vector u₁ ^(N) accordingan encoding formula, to obtain the encoded bit sequence; wherein theencoding formula is:x ₁ ^(N) =u ₁ ^(N) G _(N), wherein x₁ ^(N)=(x₁, x₂, . . . , x_(N)) isthe encoded bit sequence, and G_(N) is a polar code generating matrix ofN rows and N columns.
 9. A non-transitory computer readable mediumstoring program codes thereon for execution by a processor in acommunication device, wherein the program codes comprise instructionsfor: obtaining K information bits, wherein K≥1; generating ato-be-encoded sequence having a length of N bits, wherein theto-be-encoded sequence comprises the K information bits and L frozenbits, wherein L is larger than or equal to (N−M), N is an integer powerof 2, and M is a positive integer and less than N; and wherein L bitpositions of the to-be-encoded sequence for placing the L frozen bitsare determined according to a rate match manner; polar encoding theto-be-encoded sequence, to obtain an encoded sequence; interleaving theencoded sequence, to obtain an interleaved sequence; sequentiallystoring the interleaved sequence into a cyclic cache of thecommunication device; and sequentially outputting M bits of theinterleaved sequence from the cyclic cache according to the ratematching manner.
 10. The non-transitory computer readable mediumaccording to claim 9, wherein the rate matching manner is puncturing,and the (N−M+1)^(th) bit to the N^(th) bit of the interleaved sequenceare output from the cyclic cache.
 11. The non-transitory computerreadable medium according to claim 9, wherein the rate matching manneris shortening, and the first bit to the M^(th) bit of the interleavedsequence are output from the cyclic cache.
 12. The non-transitorycomputer readable medium according to claim 9, wherein the instructionsfor polar encoding the to-be-encoded sequence to obtain the encodedsequence: generating a binary row vector u₁ ^(N)=(u₁, u₂, K, u_(N)),wherein the binary row vector corresponds to the to be encoded sequence;and encoding the binary row vector u₁ ^(N) according an encodingformula, to obtain the encoded bit sequence; wherein the encodingformula is:x ₁ ^(N) =u ₁ ^(N) G _(N), wherein x₁ ^(N)=(x₁, x₂, . . . , x_(N)) isthe encoded bit sequence, and G_(N) is a polar code generating matrix ofN rows and N columns.